#include "stdafx.h"
#include "CBufferBase.h"

NAMESPACE_UI_BEGIN

byte_t * CBufferBase::GetLine(int_32 iY) const
{
	VerifyPointer(GetBuffer());

	if(iY < 0 || iY >= GetHeight())
		throw CIllegalArgumentException();

	return GetBuffer() + (iY * GetPitch());
}

byte_t * CBufferBase::GetPoint(int_32 iX, int_32 iY) const
{
	VerifyPointer(GetBuffer());
	if(iX < 0 || iX >= GetWidth() ||
		iY < 0 || iY >= GetHeight())
		throw CIllegalArgumentException();

	return GetBuffer() + (iY * GetPitch()) + iX * GetStrike();
}

void CBufferBase::SetSize(int_32 iWidth, int_32 iHeight)
{
	GetRender()->SetBufferSize(this, iWidth, iHeight);
}

void CBufferBase::CopyTo(IBuffer * pBuffer, const CRectInt32 & rectSrc) const
{
}

void CBufferBase::CopyTo(IBuffer * pBuffer, const CPointInt32 & posDst, const CRectInt32 & rectSrc) const
{
}

NAMESPACE_UI_END